package model.workersWithData.sort;

import java.util.Comparator;

public class SortBy {
	
	private static Comparator SORT_MASTER_BY_EMPLOYMENT = new SortMasterByEmployment();
	private static Comparator SORT_MASTER_BY_NAME = new SortMasterByName();
	private static Comparator SORT_ORDERS_BY_BEGINING_DATE = new SortOrderByBeginningDate();
	private static Comparator SORT_ORDERS_BY_DEADLINE_DATE = new SortOrderByDeadlineDate();
	private static Comparator SORT_ORDERS_BY_FILLING_DATE = new SortOrderByFillingDate();
	private static Comparator SORT_ORDERS_BY_PRICE = new SortOrderByPrice();
	private static Comparator<Object> result;

	public static Comparator SortBy(SortObjectBy sortBy) {

		if (SortObjectBy.SORT_MASTER_BY_EMPLOYMENT == sortBy) {
			result = SORT_MASTER_BY_EMPLOYMENT;

		} else if (SortObjectBy.SORT_MASTER_BY_NAME == sortBy) {
			result = SORT_MASTER_BY_NAME;
		} else if (SortObjectBy.SORT_ORDERS_BY_BEGINING_DATE == sortBy) {
			result = SORT_ORDERS_BY_BEGINING_DATE;
		} else if (SortObjectBy.SORT_ORDERS_BY_DEADLINE_DATE == sortBy) {
			result = SORT_ORDERS_BY_DEADLINE_DATE;
		} else if (SortObjectBy.SORT_ORDERS_BY_FILLING_DATE == sortBy) {
			result = SORT_ORDERS_BY_FILLING_DATE;
		} else if (SortObjectBy.SORT_ORDERS_BY_PRICE == sortBy) {
			result = SORT_ORDERS_BY_PRICE;
		}

		return result;
	}

}
